package com.yzt.zhuju.dialog;

import android.view.View;
import android.widget.TextView;

import com.yzt.zhuju.R;
import com.yzt.zhuju.utils.SpannableFactory;
import com.yzt.zhuju.widget.tuiview.TUILinearLayout;

/**
 * author : bob
 * date   : 2023/2/16
 * desc   : 匹配弹窗
 */
public class RandomMatchDialog extends CenterBaseDialog {

    private TextView tvPrice;

    private TUILinearLayout ll_match;

    @Override
    public int getLayoutRes() {
        return R.layout.dialog_random_match;
    }

    @Override
    public void bindView(View v) {

        String diamond = getArguments().getString("extra_diamond");
        tvPrice = findViewById(R.id.tv_price);
        tvPrice.setText(SpannableFactory
                .create(diamond)
                .appendImage(R.mipmap.icon_index_match_diamond)
                .append("/min")
                .build());
        ll_match = findViewById(R.id.ll_match);
        ll_match.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (listener!=null){
                    listener.onMatch();
                }
                dismissAllowingStateLoss();
            }
        });
    }

    private OnMatchListener listener;

    public void setOnMatchListener(OnMatchListener listener) {
        this.listener = listener;
    }

    public interface OnMatchListener {

        void onMatch( );
    }
}
